<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <!--头部固定引用-->
  <meta charset="utf-8">
  <meta name="full-screen" content="yes">
  <meta name="x5-fullscreen" content="true">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
  <link rel="stylesheet" href="../../css/base.css">
  <!--固定引用结束,自定义引用添加在下面-->
  <title>JT2</title>
  <!--页面样式添加在这里，多看看base。css里面的公共样式，大部分常用的都有，避免使用独立css文件为单独页面设置样式，避免随意添加样式到公共样式-->
  <style>
      .addhearsay-header img {
          width: 0.32rem;
          height: 0.32rem;
          position: absolute;
          left: 0.32rem;
          top: 50%;
          transform: translateY(-50%);
      }
      .addhearsay-content {
        padding: 0.42rem  0.32rem  0  0.32rem;
      }
      .inputtitle {
          margin-bottom: 0.34rem;
      }
      .suggest {
        font-family: PingFangSC-Regular;
        font-size: 0.28rem;
        color: #959595;
        line-height: 0.44rem;
        margin-bottom: 0.48rem;
      }
      .dec {
          position: relative;
      }
      /*  */
    .addhearsay-header {
    padding:0.22rem 0.32rem 0.26rem;
    font-family: PingFangSC-Medium;
    font-size: 0.32rem;
    letter-spacing: 0;
    text-align: center;
    position: relative;
    height: 0.88rem;
  }
  .comfirmAdd {
    position: absolute;
    top: 0.22rem;
    right: 0.32rem;
    font-family: PingFangSC-Regular;
    font-size: 0.28rem;
    letter-spacing: 0;
    text-align: left;
  }
  .title {
    font-family: PingFangSC-Semibold;
    font-size: 0.28rem;
    line-height: 0.4rem;
    margin-bottom: 0.2rem;
  }
  .inputtitle input{
    height: 0.8rem;
    width: 6.86rem;
    padding: 0.18rem 0  0.26rem  0.16rem;
    font-family: PingFangSC-Regular;
    font-size: 0.26rem;
  }
  .explain {
    font-family: PingFangSC-Semibold;
    font-size: 0.28rem;
    line-height: 0.4rem;
    margin-bottom: 0.2rem;
  }
  .dec textarea{
    width: 6.86rem;
    height: 3.4rem;
    border-radius: 0.04rem;
    font-family: PingFangSC-Regular;
    font-size: 0.26rem;
    padding-top: 0.18rem;
    padding-left: 0.16rem;
    border: none;
    outline:none;
  }
  .dec span {
    position: absolute;
    bottom: -0.26rem;
    right: 0;
    font-family: PingFangSC-Regular;
    font-size: 0.26rem;
  }
  </style>
</head>
<!--尽量不要在body上添加样式，除了背景色-->
<body>
<div>
  <!--具体代码-->
  <!-- 头部 -->
  <div class="addhearsay-header">
    <img src="../../images/allPic/jiantou.png" alt="" onclick='closeWindow()' class="headerimg">
    <span>新增求证</span>
    <span class="comfirmAdd" onclick="comfirmAdd()">提交</span>
  </div>

  <!-- 新增主体 -->
  <div class="addhearsay-content">
      <div class="title">求证公司</div>
      <div class="inputtitle">
          <input type="text" class="ipttitle" placeholder="请输入公司...">
      </div>
      <div class="suggest">
        <!-- （* 建议使用#话题内容#格式发布话题） -->
      </div>
      <div class="explain">
          求证内容
      </div>
      <div class="dec">
          <textarea name="dectextarea" id="dectextarea" maxlength="200" οnchange="this.value=this.value.substring(0, 200)" οnkeydοwn="this.value=this.value.substring(0, 200)" οnkeyup="this.value=this.value.substring(0, 200)" placeholder="请输入内容..."></textarea>
          <span>0/200</span>
      </div>
  </div>


</div>
</body>
<!--下面五个文件为固定引用，自己根据情况调整路径，不要跟换引入顺序，其他引用添加在后面-->
<script src="../../js/dict.js"></script>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/checkJsBridge.js"></script>
<script src="../../js/utils.js"></script>
<script src="../../js/api.js"></script>
<!--固定引用结束-->
<!--避免一个页面包含过多功能，减少js重绘页面，推荐分功能，分页面-->
<script>
  /*固定页面初始化方法，用于替代$(function(){}),param为url参数，Object类型*/
  function initPage(params) {

    //设置深色模式
    if(configColorType === '1'){
        $('.headerimg').attr('src','../../images/allPic/blackfanhui.png')
    }else{
        $('.headerimg').attr('src','../../images/allPic/jiantou.png')
    }

  }

  /*页面所在窗口由后台前台时触发的方法,param为url参数，Object类型*/
  function startPage(params) {

  }

  function reLoadPage() {

  }
  $('#dectextarea').on('input',function(e){
    // console.log(e.target.value)
    let num = e.target.value.length
    $('#dectextarea').next().text(num+'/200')
  })
  //提交新增
  function comfirmAdd(){
    let value1 = $('.ipttitle').val().trim()
    let value2 = $('#dectextarea').val().trim()
    if(value1 === '' || value2=== ''){
      jsBridge.toast('公司或内容不能为空...')
    }else if(value1.length>30){
      jsBridge.toast('公司不能超过三十个字符...')
    }else{
      Server.addInteraction.addhearsay({interactionDto:{'owner':value1,'mainTitle':value2}}).then(res => {
        if(res.code === 0){
          // jsBridge.openWindow('/html/hearsay/hearsayVerification.html',{}, {noBar: false})
          // jsBridge.toast('新增成功')
          //新增之后通知原生页面刷新
          jsBridge.updateStatus({'type':'hudong','name':'refresh'})
          jsBridge.updateStatus({'type':'refresh','name':'refresh','infoId':'','value':'1'})
          jsBridge.closeWindows()
        }else if(res.code === -8){
          jsBridge.delData('token')
          token = ''
          jsBridge.toast('登录过期，请重新登录')
        }else{

        }
      })
    }
  }
  //点击返回按钮
  function closeWindow(){
    jsBridge.closeWindows()
  }
</script>
</html>
